/* Import all components */
@import 'themes/default/globals/site.variables';
@import 'themes/pxt/globals/site.variables';

/* Reference import */
@import (reference) "semantic.less";

@inlineBlockColor: #D83B01;
@highlightLineColor: #fcfc90;
@tutorialCardHeight: 8rem;
@seeMoreButtonHeight: 4rem;
@avatarSize: 4.5rem;
@avatarMargin: @avatarSize + 0.5rem;
@mobileAvatarMargin: 2rem;
@workspaceHeaderHeight: 2rem;

/*******************************
      Tutorial mode
*******************************/
.tutorial #maineditor .full-abs {
    top: @tutorialCardHeight;
}

.tutorial.flyoutOnly #maineditor .full-abs {
    top: calc(@tutorialCardHeight + @workspaceHeaderHeight);
}

.tutorial #maineditor #monacoEditor {
    top: 0rem;
}
/* Tutorial Mode */
.menubar .ui.menu .item.tutorial-menuitem {
    background: rgba(27, 28, 29, 0.3) !important;
    margin: 0.45rem;
    padding: 0.45rem;
    border-radius: 0.5rem !important;
}
.menubar .ui.menu .item.tutorial-menuitem > .step-label {
    margin-left: 0.4em;
    margin-right: 0.4em;
}
.menubar .ui.menu .item.tutorial-menuitem > .label {
    background: white;
    margin-left: 0em;
}
.tutorial-menuitem > .selected {
    background-color: @tutorialSelectedMenuColor !important;
    padding: 1.0rem !important;
    padding-left: 1.3rem !important;
    padding-right: 1.3rem !important;
}

.tutorial #tutorialcard {
    position: relative;
    z-index: @tutorialCardZIndex;
    height: @tutorialCardHeight;
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    font-family: @docsPageFont;
}

.tutorial #tutotialcard > code,
.tutorial #tutotialcard > pre {
    font-family: @pageFont;
}

.tutorial.tutorialExpanded #tutorialcard {
    max-height: 20rem;
}

#root.dimmable.dimmed #tutorialcard.tutorialReady {
    z-index: @tutorialLightboxCardZIndex;
}

#tutorialhint {
    height: 100%;
}

#tutorialcontent {
    position: fixed;
    top: 0;
    left: 0;
}

body#docs.tutorial {
    overflow-y: hidden;
}
#docs.tutorial .ui.segment {
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: none;
}
#docs.tutorial #root{
    margin-bottom: 0.5rem !important;
}

/******************************
    Tutorial Avatar
******************************/

#tutorialcard .ui.tutorialsegment {
    width: 100%;
    position: relative;
    padding: 0;
    border: 0;
    border-radius: 0px;
    background: @tutorialSegmentBackground;
}

#tutorialcard .ui.tutorialsegment svg {
    -webkit-transform: translate3d(0, 0, 0);
}

#tutorialcard {
    padding: 0.5rem;
}

#tutorialcard .ui.tutorialsegment .avatar-image {
    position: absolute;
    width: @avatarSize;
    height: @avatarSize;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: @avatarImage;
    cursor: pointer;
}

.tutorial #tutorialcard .ui.buttons {
    width: 100%;
    height: calc(@tutorialCardHeight - 1rem);
}

.tutorial.tutorialExpanded #tutorialcard .ui.buttons {
    height: 100%;
}

#tutorialcard .ui.tutorialsegment {
    width: 100%;
}

.tutorial #tutorialcard .tutorialmessage .content {
    width: 100%;
    font-size: 12pt;
    height: calc(@tutorialCardHeight - 1rem);
    margin-bottom: 0.4rem;
    overflow-y: hidden;
    overflow-x: auto;
    cursor:pointer;
}

.tutorial.tutorialExpanded #tutorialcard .tutorialmessage .content {
    height: calc(~'100% + 2px');
    overflow-y: auto;
}

#tutorialcard .tutorialmessage .content p,
.tutorialhint p {
    line-height: 1.7em !important;
    color: @tutorialSegmentColor;
}

.tutorial #tutorialcard .tutorialmessage {
    width: ~'calc(100% - @{avatarMargin} - 0.5rem)';
    padding: 0.5rem;
    height: calc(@tutorialCardHeight - 1.5rem);
    margin-left: @avatarMargin + 0.35rem;
    overflow: hidden;
}

.tutorial.tutorialExpanded #tutorialcard .tutorialmessage {
    height: 100%;
}

#root.dimmable.dimmed .ui.segment.message {
    border-radius: 5px;
}

/* Show / Hide in dimmer */
.ui.showlightbox {
    display: none;
}

#root.dimmable.dimmed #tutorialcard.tutorialReady .ui.showlightbox {
    display: block;
}

#root.dimmable.dimmed #tutorialcard.tutorialReady .ui.hidelightbox {
    display: none;
}

#root.dimmable.dimmed #tutorialcard.tutorialReady .ui.prevbutton, #root.dimmable.dimmed #tutorialcard.tutorialReady .ui.nextbutton {
    opacity: 0 !important;
    z-index: -1;
}

#tutorialcard .ui.button.okbutton {
    border-radius: 0.28571429rem;
}

i.icon.avatar-image {
    background-repeat: no-repeat;
    background-size: contain;
    background-image: @avatarImage;
}

/* Tutorial blocks */
.hintdialog .ui.segment .blocklyPreview {
    width: 100%;
}

@media only screen and (min-height: 400px) {
    .hintdialog .ui.segment .blocklyPreview,
    .tutorialhint .ui.segment .blocklyPreview {
        max-height: 45vh;
    }
}

@media only screen and (max-height: 800px) {
    .tutorialhint img {
        max-height: 30vh;
    }
}

/******************************
    Inline Blocks and Buttons
******************************/

span.docs.inlinebutton {
    padding: 0.4rem;
    border-radius: 0.2rem;
    white-space: nowrap;
    background-color: @primaryColor;
    color: @white;
}

span.docs.inlineblock {
    padding: 0.05rem .2rem;
    border-radius: .2rem;
    white-space: nowrap;
    background-color: @inlineBlockColor;
    color: @white;
    font-family: @blocklyFont !important;
    font-size: 1em !important;
}

code.lang-filterblocks {
    display: none;
}

span.highlight-line {
    font-weight: bold;
    white-space: pre-wrap;
    background: @highlightLineColor;
    display: block;
    padding: 0.5rem;
}

#tutorialcard .prevbutton,
#tutorialcard .nextbutton {
    background: @tutorialSegmentBackground;
    z-index: 2;

    > i, > span {
        display: block;
        margin: 0 auto 0.5em !important;
        color: @mainMenuTutorialButtons;
    }

    &:hover, &:focus {
        background-color: @lightGrey;

        > i, > span, > i.orange {
            color: @black !important;
        }
    }
}

/******************************
    Hint button
******************************/

#tutorialcard .ui.button.hintbutton {
    position: absolute;
    color: white; // match menubutton color
    border-radius: 50%;
}

/*******************************
        Tutorial Hint
*******************************/

.ui.modal.hintdialog .content p {
    font-size: 16px;
    line-height: 25px;
}

.ui.modal.hintdialog {
    .ui.segment {
        display: flex;
        min-height: 100px;
    }
}

.ui.modal.hintdialog,
.tutorialsegment .tutorialmessage {
    img {
        margin-left: auto;
        margin-right: auto;
    }
}

.tutorialhint {
    position: absolute;
    max-width: 100%;
    min-width: 300px;
    top: 6.5rem;
    padding: 10px 26px;
    border-radius: 1.2rem;
    background: @white;
    z-index: @tutorialLightboxCardZIndex;
    border: 8px solid @blue;
    box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, .3);
}

.tutorialhint:before {
    content: ' ';
    position: absolute;
    width: 0;
    height: 0;
    left: 5px;
    right: auto;
    top: -24px;
    bottom: auto;
    border: 16px solid;
    border-color: transparent @blue transparent transparent;
    transform: rotateZ(-45deg);
}

.tutorialhint > div {
    max-height: 60vh;
    overflow: auto;
}

.tutorialhint.hidden {
    display: none;
}

.tutorialhint .lang-blocks .segment.raised {
    border: none;
    background: none;
    box-shadow: none;
    text-align: center;
    min-height: 3em;
}

.shake {
    animation: shake 1.5s ease-in-out;
}

.tutorial .mask {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
}

/*******************************
     Tutorial Tooltip
*******************************/
.avatar-container {
    position: absolute;
    top: .9rem;
    left: .7rem;
    width: 100%;
}

.avatar-container .tooltip {
    top: 5rem;
    left: 1.5rem;
    max-width: 175px;
}

.avatar-container .tooltip ,
.avatar-container .tooltip:before {
    background-color: @blue;
    color: @white;
}

.hideIteration .avatar-container .tooltip {
    left: 4.5rem;
}

.hideIteration .avatar-container .tooltip:before {
    left: 27%;
}

#tutorialcard:not(.showTooltip) .tooltip,
#tutorialcard:not(.showTooltip) .tooltip:before {
    display: none;
}

/*******************************
        See More Button
*******************************/
#tutorialcard.seemore {
    .tutorialsegment > button {
        position: relative;
        top: -0.75rem;
        width: auto;
        margin: auto;
        padding: 0.5rem 0.8rem;
    }
}

/*******************************
      Tutorial Activity UI
*******************************/
#tutorialsteps {
    padding: 1em 0px;
}

#tutorialsteps .step-label {
    margin: 0 1em;
}

#tutorialsteps .button.nextbutton .text {
    margin-right: 0.5em;
}

#tutorialdropdown > .text {
    margin: 0.5em;
}

/*******************************
        Progress Circle
*******************************/
.progresscircle {
    position: absolute;
    width: 2.4em;
    height: 2.4em;
    margin-top: -0.345em;
    margin-left: -0.2em;
}

.progresscircle path {
    stroke: @white;
    fill: none;
    stroke-linecap: round;
}

/*******************************
        Workspace headers
*******************************/
#headers {
    display: flex;
    position: relative;
    height: @workspaceHeaderHeight;
    color: @white;
    z-index: @simulatorZIndex;

    #workspaceHeader {
        flex: 1;
    }

    #flyoutHeader {
        box-sizing: content-box;
    }

    div {
        display: inline-block;
        text-align: center;
        line-height: 2rem;
        font-weight: 800;
    }
}

/*******************************
        Media Adjustments
*******************************/


/* > Small Monitor */
@media only screen and (min-width: @computerBreakpoint) {
}

/* Large Monitor */
@media only screen and (min-width: @largeMonitorBreakpoint) {

}

/* Small Monitor */
@media only screen and (min-width: @computerBreakpoint) and (max-width: @largestSmallMonitor) {

}

/* Tablet */
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
    .avatar-container .tooltip:before {
        left: 2rem;
    }
}

/* Mobile */
@media only screen and (max-width: @largestMobileScreen) {
    #tutorialcard .ui.button.prevbutton {
        display: none;
    }

    // hide avatar, adjust card width
    .avatar-image {
        display: none;
    }

    .tutorial #tutorialcard .tutorialmessage {
        width: ~'calc(100% - @{mobileAvatarMargin} - 0.5rem)';
        margin-left: @mobileAvatarMargin + 0.35rem;
    }

    #tutorialcard:not(.hasHint) .tutorialmessage {
        width: ~'calc(100% - .5rem)';
        margin-left: 0.35rem;
    }

    // mobile hint positioning
    .tutorialhint {
        top: 3.5rem;
    }

    .tutorialhint:before {
        left: -5px;
    }

    // mobile tutorial tooltip positioning
    .avatar-container .tooltip {
        top: 2rem;
    }

    .avatar-container .tooltip:before {
        left: 1rem;
    }
}

/* >= Small Monitor (Small Monitor + Large Monitor + Wide Monitor) */
@media only screen and (min-width: @computerBreakpoint) {
}

/* <= Small Monitor (Mobile + Tablet + Small Monitor) */
@media only screen and (max-width: @largestSmallMonitor) {

}

/* <= Tablet (Mobile + Tablet) */
@media only screen and (max-width: @largestTabletScreen) {
    .avatar-container .tooltip {
        left: 5rem;
    }

    #tutorialdropdown {
        width: auto;
    }
}

/* thin screen */
@media only screen and (max-height: @tallEditorBreakpoint) and (min-width: @largestMobileScreen) {
    .tutorial #tutorialcard {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .tutorial #tutorialcard .content {
        font-size: 10pt;
    }

    .modal.hintdialog img.ui.centered.image {
        max-height:12rem;
    }
}

@keyframes shake {
    0% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(-10deg);
    }

    20% {
        transform: rotate(10deg);
    }

    30% {
        transform: rotate(-10deg);
    }

    40% {
        transform: rotate(10deg);
    }

    50% {
        transform: rotate(-10deg);
    }

    60% {
        transform: rotate(10deg);
    }

    70% {
        transform: rotate(-10deg);
    }

    80% {
        transform: rotate(10deg);
    }

    90% {
        transform: rotate(-10deg);
    }

    100% {
        transform: rotate(0deg);
    }
}